package com.sync.syncmasterdata.usercenter.service;

import com.sync.syncmasterdata.usercenter.entity.oa.UserForOa;
import com.sync.syncmasterdata.usercenter.repository.oa.UserForOaRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * user服务
 */
@Service
public class UserServiceImpl {

    @Autowired
    private UserForOaRepository oaUserRepository;

    /**
     * 获取userid by phone
     */
    public Integer getUserid(String s) {
        try {
            UserForOa userForOa =oaUserRepository.getUserIdByPhone(s);
            if (userForOa != null) {
                return userForOa.getId();
            }
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
        return null;
    }

    public Integer getDepartmentid(String s) {
        try {
            UserForOa userForOa =oaUserRepository.getUserIdByPhone(s);
            if (userForOa != null) {
                return userForOa.getDepartmentid();
            }
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
        return null;
    }

}
